<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/19 0019
  Time: 9:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>新建跟踪</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">客户：</label>
        <div class="layui-input-inline" style="width: 300px">
            <select name="status">
                <option value="">-请选择客户-</option>
                <option value="1">成交客户</option>
                <option value="2">潜在客户</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">时间：</label>
        <div class="layui-input-inline" style="width: 300px">
            <input type="text" name="time" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地点：</label>
        <div class="layui-input-inline" style="width: 300px">
            <input type="text" name="address" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">结果：</label>
        <div class="layui-input-inline" style="width: 300px">
            <input type="text" name="result" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">概要：</label>
        <div class="layui-input-inline">
            <textarea cols="37" name="general" placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">详细信息：</label>
        <div class="layui-input-inline">
            <textarea cols="37" name="content" placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-inline">
            <textarea cols="37" name="remark" placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">相关文件：</label>
        <div class="layui-input-inline">
            <button type="button" class="layui-btn" style="background: lightskyblue">选择文件</button>
        </div>
    </div>
    <div class="layui-form-item" style="width: 450px">
        <div class="layui-input-block">
            <button type="reset" class="layui-btn">重置</button>
            <button lay-submit lay-filter="save" class="layui-btn">保存</button>
        </div>
    </div>
</form>

<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    //layui引入特定模块的方式
    layui.use(['layer', 'form','jquery'], function(){
        var layer = layui.layer//layer:弹窗对象
            ,form = layui.form;//表单对象
        var $=layui.$;

        layer.msg('Hello World');
        //表单提交监听
        form.on("submit(save)",function (data) {
            //发起异步请求，新增
            $.post("${pageContext.request.contextPath}/connection/add",data.field,function (result) {
                if (result.code==0){
                    layer.msg("新建客户成功")
                    //刷新父窗口的表格
                    parent.layui.table.reload("customerTable",{
                        page:{
                            curr:1
                        }
                    })
                    //关闭本窗口
                    //当你在iframe页面关闭自身时
                    var index=parent.layer.getFrameIndex(window.name);//先得到当前iframe层的索引
                    parent.layer.close(index);//再执行关闭
                }
            },"json")
            return false;
        })
    });
</script>
</body>
</html>
